﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SkyFab.Master" AutoEventWireup="true" CodeBehind="MakeVendorInvoice.aspx.cs" Inherits="Web.MakeVendorInvoice" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            height: 31px;
        }
        .style2
        {
            width: 260px;
        }
        .style3
        {
            height: 31px;
            width: 260px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:Label ID="FlashMessageLabel" runat="server"></asp:Label>
<asp:ScriptManager ID="ScriptManager1" runat="server">
                </asp:ScriptManager>
<h1>Vendor Invoice</h1>

    <div class="span-9">
    <fieldset>
    <legend>Vendor Information</legend>
    <p>
    <label>Vendor:</label>
    <asp:DropDownList ID="VendorDropDownList" runat="server" Width="200" 
            AutoPostBack="True" 
            onselectedindexchanged="VendorDropDownList_SelectedIndexChanged">
    </asp:DropDownList>
    </p>

    <p>
    <label>Vendor PO NO:</label>
    <asp:DropDownList ID="VendorPODropDownList" runat="server" 
            OnSelectedIndexChanged="VendorPODropDownList_SelectedIndexChanged" Width="180" 
            AutoPostBack="True">
    </asp:DropDownList>
    </p>

    </fieldset>
    
    </div>

    <div class="span-9">
    <fieldset>
    <legend>Invoice Information</legend>

    <p>
    <label>Invoice No:</label>
    <asp:TextBox ID="InvoiceNoTextBox" runat="server" CssClass="text" Width="200"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                    ControlToValidate="InvoiceNoTextBox" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
    </p>

    <p>
    <label>Date:</label>
    <asp:TextBox ID="DateTextBox" runat="server" CssClass="text" Width="100"></asp:TextBox>
                <asp:CalendarExtender ID="DateTextBox_CalendarExtender" runat="server" 
                    Enabled="True" TargetControlID="DateTextBox" Format="d MMM, yyyy">
                </asp:CalendarExtender>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                    ControlToValidate="DateTextBox" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
    <label>Paid:</label>
    <asp:CheckBox ID="PaidCheckBox" runat="server" />
    </p>
    </fieldset>
    </div>
                
           
    <div class="span-18">
    <fieldset>
    <legend>Add Item To Invoice</legend>

    <p>
    <label>Vendor PO Item:</label>
    <asp:DropDownList 
                    ID="POItemAndRequestedDateDropDownList" runat="server" AutoPostBack="True" 
                    onselectedindexchanged="POItemAndRequestedDateDropDownList_SelectedIndexChanged" Width="200">
                </asp:DropDownList>

    <label>Unit Price:</label><asp:Label ID="UnitPriceLabel" runat="server"></asp:Label>
    </p>

    <p>
    <label>Batch No:</label>
    <asp:TextBox ID="BatchNoTextBox" runat="server" CssClass="text" Width="180"></asp:TextBox>

    <label>Quantity:</label>
    <asp:TextBox ID="QuantityTextBox" runat="server" CssClass="text" Width="50"></asp:TextBox>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                    ControlToValidate="QuantityTextBox" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                    ControlToValidate="QuantityTextBox" ErrorMessage="*" ForeColor="Red" 
                    ValidationExpression="^[1-9]\d*$"></asp:RegularExpressionValidator>

    <asp:Button ID="InsertButton" runat="server" Text="Insert" 
                    onclick="InsertButton_Click" CssClass="submitButton"/>
    </p>

    <p>
    <label>Selected Items:</label>
    <asp:GridView ID="InvoiceItemGridView" runat="server" CellPadding="4" 
                    GridLines="None" AutoGenerateColumns="False" CssClass="gridview" Width="100%">
                    <AlternatingRowStyle BackColor="White" />
                    <Columns>
                        <asp:BoundField HeaderText="No" DataField="ProductNo" />
                        <asp:BoundField DataField="ProductName" HeaderText="Name" />
                        <asp:BoundField DataField="Revision" HeaderText="Rev." />
                        <asp:BoundField DataField="Quantity" HeaderText="Qty" />
                        <asp:BoundField DataField="UnitPrice" HeaderText="Unit Price" />
                        <asp:BoundField DataField="Amount" HeaderText="Amount" />
                        <asp:TemplateField Visible="False" ItemStyle-Width="0">
                            <ItemTemplate>
                                <asp:HiddenField ID="ProductIdHiddenField" runat="server" Value='<%#Eval("ProductId") %>'/>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField Visible="False" ItemStyle-Width="0">
                            <ItemTemplate>
                                <asp:HiddenField ID="VendPOItemIdHiddenField" runat="server" 
                                    Value='<%#Eval("VendPOItemId") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Action">
                        <ItemTemplate>
                            <asp:Button ID="DeleteVendorInvoiceItemButton" runat="server" Text="Delete"  ToolTip="Delete" 
                                onclick="DeleteVendorInvoiceItemButton_Click" OnClientClick="if(confirm('Record will be deleted from databse, are you sure?')==false){return false;}"  CssClass="submitButton" />
                        </ItemTemplate>
        </asp:TemplateField>
                    </Columns>
                    
                    <AlternatingRowStyle BackColor="White" />
                    <EditRowStyle BackColor="#2461BF" />
                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <PagerStyle HorizontalAlign="Center" CssClass="pagerTable" />
                    <RowStyle BackColor="#EFF3FB" />
                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                    <SortedAscendingCellStyle BackColor="#F5F7FB" />
                    <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                    <SortedDescendingCellStyle BackColor="#E9EBEF" />
                    <SortedDescendingHeaderStyle BackColor="#4870BE" />
                </asp:GridView>
    </p>
    </fieldset>
    </div>
            
    <div class="span-18">
    <asp:Button ID="AddVendorInvoiceButton" runat="server" 
                    Text="Add Vendor Invoice" onclick="AddVendorInvoiceButton_Click" CssClass="longButton right" />
    </div>      
                
</asp:Content>
